using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using System.Threading;

namespace The_LarX
{
    public static class EngineSystem
    {
        public static List<Plant> Plants = new List<Plant>();
        public static List<Tree> Trees = new List<Tree>();

        public static List<Sprite2D> Sprites = new List<Sprite2D>();
        public static Sprite2D Sprite_ByName(string Name)
        {
            foreach (Sprite2D sprite in Sprites)
            {
                if (sprite.Name == Name)
                    return sprite;
            }
            return null;
        }

        public static List<VisualScript> VisualScripts = new List<VisualScript>();

        public static List<Actor> Actors = new List<Actor>();
        public static Actor Actor_ByName(string Name)
        {
            foreach (Actor actor in Actors)
            {
                if (actor.Name == Name)
                    return actor;
            }
            return null;
        }

        public static Dictionary<string, Renderer> Renderers = new Dictionary<string, Renderer>();
        public static Renderer GetRenderer(string rendererName)
        {
            if (!string.IsNullOrEmpty(rendererName))
            {
                return EngineSystem.Renderers[rendererName];
            }
            else
            {
                if (EngineSystem.Renderers.Count > 0)
                {
                    return EngineSystem.Renderers.Values.First();
                }
            }
            return null;
        }
        public static List<Renderer> RenderersList = new List<Renderer>();

        public static List<Trigger> Triggers = new List<Trigger>();
        
        public static List<BepuEntity> BepuEntities = new List<BepuEntity>();
        public static BepuEntity BepuEntity_ByName(string Name)
        {
            foreach (BepuEntity bepu in BepuEntities)
            {
                if (bepu.Name == Name)
                    return bepu;
            }
            return null;
        }

        public static List<ILight> LightsInterface = new List<ILight>();

        public static List<Component> Components = new List<Component>();
        public static Component Component_ByName(string Name)
        {
            foreach (Component comp in Components)
            {
                if (comp.Name == Name)
                    return comp;
            }
            return null;
        }

        public static List<Camera3D> Cameras = new List<Camera3D>();

        public static List<Viewport> Viewports = new List<Viewport>();

        public static List<Thread> RunningThreads = new List<Thread>();
    }
}